package java_0629;

public class ThreadDemo12 {
    public static void main(String[] args) {
        Thread thread =  new Thread(){
            @Override
            public void run() {
                int count = 0;
                while(count < 5){
                    System.out.println("线程运行中");
                    count++;
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
                System.out.println("线程运行结束");
            }
        };
        thread.start();
        try {
            System.out.println("join开始执行");
            thread.join();
            System.out.println("join执行结束");
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
